package com.example.moblie2021606143cwj0408;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

public class MainActivity3 extends AppCompatActivity {

    private ConstraintLayout tvMain1;
    private EditText edt2;
    private TextView tvMainMax;
    private TextView tvMainTitle3;
    private TextView textView3;
    private TextView tvInt1;
    private EditText edt1;
    private TextView tvInt2;
    private TextView tvInt3;
    private EditText edt3;
    private Button btn1;
    private TextView tvMainResult2;
    int max = 0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        initView();
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edt1.getText().toString();
                String string1 = edt2.getText().toString();
                String string2 = edt3.getText().toString();
                int num1=Integer.valueOf(string).intValue();
                int num2=Integer.valueOf(string1).intValue();
                int num3=Integer.valueOf(string2).intValue();
                if (num1 > num2 ){
                    max = num1;
                }else {
                    max = num2;
                }
                if (num2 > num3){
                    max = num2;
                }else {
                    max = num3;
                }
                if (num1 > num3){
                    max = num1;
                }else {
                    max = num3;
                }
                string=String.valueOf(max);
                tvMainResult2.setText(string);
            }
        });
    }



    private void initView() {
        tvMain1 = findViewById(R.id.tv_main1);
        edt2 = findViewById(R.id.edt2);
        tvMainMax = findViewById(R.id.tv_main_max);
        tvMainTitle3 = findViewById(R.id.tv_main_title3);
        textView3 = findViewById(R.id.textView3);
        tvInt1 = findViewById(R.id.tv_int1);
        edt1 = findViewById(R.id.edt1);
        tvInt2 = findViewById(R.id.tv_int2);
        tvInt3 = findViewById(R.id.tv_int3);
        edt3 = findViewById(R.id.edt3);
        btn1 = findViewById(R.id.btn_1);
        tvMainResult2 = findViewById(R.id.tv_main_result2);
    }
}